package com.unisedu.hr.controller;

import com.unisedu.hr.basic.IBaseEntity;
import com.unisedu.hr.entity.Office;
import com.unisedu.hr.layui.Table;
import com.unisedu.hr.service.OfficeService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.Service;
import java.util.List;

@RestController
@RequestMapping("/office")
public class OfficeController {

    private OfficeService officeService;

    public OfficeController(OfficeService service){
        this.officeService = service;
    }

    @RequestMapping(value = "tree", method = RequestMethod.GET)
    public List<IBaseEntity> findList(){
        return officeService.findTreeData();
    }

    @RequestMapping(value = "list", method = RequestMethod.GET)
    public Table findTableData(Office office, @RequestParam Integer page, @RequestParam Integer limit){
        return officeService.findPage(office,page,limit);
    }


}
